package com.socodethis.spaceex;

import java.util.ArrayList;

import com.badlogic.gdx.graphics.g2d.Sprite;
import com.socodethis.spaceex.math.cPoint;

//This class holds one individual tile
//Each tile consists of a Floor Property. Structure Property is optional
public class TileClass {
	private SpriteProperties Structure, Floor, Dirt;
	
	//This is for structures that change throughout the course of the game. Field needs to be expanded later
	private SpriteProperties switchStructure;
	private boolean switchOn;
	public TileClass(TileClass tile){
		this.Structure = tile.Structure;
		this.Floor = tile.Floor;
		this.Dirt = tile.Dirt;
		this.switchStructure = tile.switchStructure;
		switchOn = tile.switchOn;
	}
	public TileClass(SpriteProperties Floor){
		this.Floor = new SpriteProperties(Floor);
		this.Dirt = new SpriteProperties("null",new Sprite(),0);
		this.Structure = new SpriteProperties("null",new Sprite(),0);
		this.switchStructure = new SpriteProperties("null",new Sprite(),0);
		switchOn = false;
	}
	public TileClass(SpriteProperties Structure, SpriteProperties Floor){
		this.Structure = new SpriteProperties(Structure);
		this.Floor = new SpriteProperties(Floor);
		this.Dirt = new SpriteProperties("null",new Sprite(),0);
		this.switchStructure = new SpriteProperties("null",new Sprite(),0);
		switchOn = false;
	}
	public void setFloor(SpriteProperties Floor){
		this.Floor = new SpriteProperties(Floor);
	}
	public void setStructure(SpriteProperties Structure){
		this.Structure = new SpriteProperties(Structure);
	}
	public void setDirt(SpriteProperties Dirt){
		this.Dirt = Dirt;
	}
	public void setSwitchStructure(SpriteProperties switchStructure){
		this.switchStructure = new SpriteProperties(switchStructure);
	}
	public SpriteProperties getCurrentStructure(){
		if(switchOn){
			return switchStructure;
		}else{
			return Structure;
		}
	}
	public SpriteProperties getStructure(){
		return Structure;
	}
	public SpriteProperties getSwitchStructure(){
		return switchStructure;
	}
	public SpriteProperties getFloor(){
		return Floor;
	}
	public SpriteProperties getDirt(){
		return Dirt;
	}
	public boolean floorHasProperty(int property){
		if(Floor.getPropAtIndex(property)){
			return true;
		}else{
			return false;
		}
	}
	public void switchDaSwitch(){
		switchOn = !switchOn; 
	}
}
